package edu.virginia.cs4501.team22;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

/**
 * Sets up the tabs for use.  Displays the destination selector tab.
 * @author William Schoen
 * @author Michael Parker
 */
public class MainTab extends TabActivity{

	Resources res;
	TabHost tabHost;
	TabHost.TabSpec spec;
	Intent intent;
	ClassFinderApp application;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		application = (ClassFinderApp)getApplicationContext();
		setContentView(R.layout.devselector);

		res = getResources(); // Resource object to get Drawables
		tabHost = getTabHost();  // The activity TabHost

		//Create the first tab
		intent = new Intent().setClass(this, ServiceOne.class);
		spec = tabHost.newTabSpec("serviceone").setIndicator("ServiceOne",
				res.getDrawable(R.drawable.dev_tab))
				.setContent(intent);
		tabHost.addTab(spec);

		//Create the map tab
		intent = new Intent().setClass(this, Map.class);
		spec = tabHost.newTabSpec("map").setIndicator("Map",
				res.getDrawable(R.drawable.map_tab))
				.setContent(intent);
		tabHost.addTab(spec);

		//create the about tab
		intent = new Intent().setClass(this, About.class);
		spec = tabHost.newTabSpec("about").setIndicator("About",
				res.getDrawable(R.drawable.about_tab))
				.setContent(intent);
		tabHost.addTab(spec);

		tabHost.setCurrentTab(0);
	}

	@Override
	public void onPause() {
		super.onPause();
	}

	@Override
	public void onResume() {
		super.onResume();
	}

	@Override
	public void onDestroy() {
		res = null;
		tabHost = null;
		spec = null;
		intent = null;
		super.onDestroy();
	}

}
